package com.itheima.reggie.execption;

import com.itheima.reggie.common.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class ExecptionControlerAdvice {

    @ExceptionHandler(RuntimeException.class)
    public R ex1(RuntimeException ex){
      log.error("出现了RuntimeException异常");
      ex.printStackTrace();
      return R.error("服务器繁忙,请稍后再试.....");
    }

}
